//
//  IZHIMContactManager.h
//  ZHIMCore
//
//  Created by Chen Zhangli on 2021/1/18.
//

#import <Foundation/Foundation.h>
#import "ZHIMContactManagerDelegate.h"
#import "ZHIMEmployee.h"
#import "ZHIMCustomerService.h"

@protocol IZHIMContactManager <NSObject>

/// 添加回调代理
/// @param delegate 要添加的代理
- (void)addDelegate:(id<ZHIMContactManagerDelegate>)delegate;


/// 移除回调代理
/// @param delegate 要移除的代理
- (void)removeDelegate:(id<ZHIMContactManagerDelegate>)delegate;


#pragma mark - 组织架构

/// 查询组织架构
/// @param completion 完成的回调
- (void)getOrganizationTreeFromServerWithCompletion:(void (^)(NSArray *contacts, NSError *error))completion;


/// 查询本地存储的联系人详情
/// @param userId 联系人ID
- (ZHIMEmployee *)getContactByUserId:(NSString *)userId;


/// 查询本地存储的联系人
/// @param keyWords 关键字
- (NSArray *)getContactsByKeyWords:(NSString *)keyWords pageIndex:(NSInteger)pageIndex pageSize:(NSInteger)pageSize;


/// 查询联系人详情
/// @param completion 完成的回调
- (void)getContactByUserId:(NSString *)userId fromServerWithCompletion:(void (^)(ZHIMUser *contact, NSError *error))completion;


#pragma mark - 好友

/// 获取本地存储的所有好友
- (NSArray *)getContacts;


/// 从服务器获取所有的好友
/// @param completion 完成的回调
- (void)getContactsFromServerWithCompletion:(void (^)(NSArray *contacts, NSError *error))completion;


/// 添加好友（暂不支持）
/// @param userId 要添加的用户Id
/// @param message 邀请信息
/// @param completion 完成的回调
- (void)addContact:(NSString *)userId
           message:(NSString *)message
        completion:(void (^)(NSString *userId, NSError *error))completion;


/// 删除好友（暂不支持）
/// @param userId 要删除的好友Id
/// @param issDeleteConversation 是否删除会话
/// @param completion 完成的回调
- (void)deleteContact:(NSString *)userId isDeleteConversation:(BOOL)issDeleteConversation
           completion:(void (^)(NSString *userId, NSError *error))completion;


/// 同意加好友的申请（暂不支持）
/// @param userId 申请者Id
/// @param completion 完成的回调
- (void)approveFriendRequestFromUser:(NSString *)userId
                          completion:(void (^)(NSString *userId, NSError *error))completion;


/// 拒绝加好友的申请（暂不支持）
/// @param userId 申请者Id
/// @param completion 完成的回调
- (void)declineFriendRequestFromUser:(NSString *)userId
                          completion:(void (^)(NSString *userId, NSError *error))completion;


#pragma mark - 黑名单

/// 从本地获取黑名单列表（暂不支持）
- (NSArray *)getBlackList;


/// 从服务器获取黑名单列表（暂不支持）
/// @param completion 完成的回调
- (void)getBlackListFromServerWithCompletion:(void (^)(NSArray *blackList, NSError *error))completion;


/// 将用户加入黑名单（暂不支持）
/// @param userId 要加入黑命单的用户Id
/// @param completion 完成的回调
- (void)addUserToBlackList:(NSString *)userId
                completion:(void (^)(NSString *userId, NSError *error))completion;


/// 将用户移出黑名单（暂不支持）
/// @param userId 要移出黑命单的用户Id
/// @param completion 完成的回调
- (void)removeUserFromBlackList:(NSString *)userId
                     completion:(void (^)(NSString *userId, NSError *error))completion;



/// 更新用户头像
/// @param avavtar 用户新头像
/// @param userId 用户id
- (void)updateAvatar:(NSString *)avavtar forUser:(NSString *)userId;

@end
